import os

from redis import StrictRedis


class Config(object):
    DEBUG = None

    SECRET_KEY = os.urandom(24)

    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost/flask_news'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host='172.0.0.1', port=6379)
    SECRET_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    DEBUG = True


class ProductionConfig(Config):
    DEBUG = False

config_dict = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}
